package com.hrzyit.whistle.cases.ui.adapter

import android.content.Context
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.hrzyit.base.ui.adapter.BaseRecyclerViewAdapter
import com.hrzyit.base.utils.DateUtils
import com.hrzyit.whistle.cases.R
import com.hrzyit.whistle.cases.data.bean.AuthMsgVo
import kotlinx.android.synthetic.main.item_approve_content.view.*
import java.util.*

/**
 * 批示内容列表适配器
 * @author YangWei
 * @date 2019/4/29
 */
class ApproveContentListAdapter(context: Context) :
    BaseRecyclerViewAdapter<AuthMsgVo, ApproveContentListAdapter.ViewHolder>(context) {
    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val view = LayoutInflater.from(mContext)
            .inflate(R.layout.item_approve_content, parent, false)
        return ViewHolder(view)

    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        super.onBindViewHolder(holder, position)
        val item = dataList[position]

        holder.itemView.mApproveTitleTv.text = "${item.authUserName}同志批示:"
        holder.itemView.mApproveContextTv.text = item.authContent
        val time = Date(item.authAddTime)
        holder.itemView.mApproveDateTv.text = DateUtils.format(time)
    }


    class ViewHolder(view: View) : RecyclerView.ViewHolder(view)
}